/**
 *
 */
package com.naiterui.ehp.bs.doctor.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.naiterui.common.repository.core.BaseJpaRepository;
import com.naiterui.ehp.bp.domain.DrConsultComment;

/**
 * 医生星级评价持久层
 * @author guoyongxiang
 * @since 2.3.0
 */
@Repository
public interface IDrConsultCommentRepository extends BaseJpaRepository<DrConsultComment, Long>  {

    long countByDoctorId(Long doctorId);

    /**
     * 查询医生会话评论
     * @param pageable
     * @return
     */
    Page<DrConsultComment> findByDoctorIdOrderByIdDesc(Long doctorId, Pageable pageable);

    /**
     * 根据会话id查询评价
     * @param consultSessionId
     * @return
     */
    DrConsultComment findFirstByConsultSessionIdAndConsultType(Long consultSessionId, Integer consultType);

    DrConsultComment findFirstByConsultSessionId(Long consultSessionId);

    List<DrConsultComment> findByDoctorId(Long doctorId);

    List<DrConsultComment> findByCreatedAtBetween(Date startDate, Date endDate);
}
